package  
{
	import net.flashpunk.World;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.utils.Input;
	import net.flashpunk.FP;

	/**
	 * ...
	 * @author Donatello
	 */
	public class FifthScene extends World
	{
		[Embed(source = "img/restaurante.png")]	private const IMG_BACK:Class;
		private var imgBack:Image;
		private var player:Couple;
		private var mesa:Mesa;
		
		public function FifthScene() 
		{
			imgBack = new Image(IMG_BACK);
			imgBack.x = 0;
			imgBack.y = 0;
			addGraphic(imgBack);
			
			player = new Couple(400, 500);
				
			mesa = new Mesa(650, 100);
			add(mesa);
			add(new Mesa(50, 100));
			add(new LineGuy(50, 100, 2));
			add(new LineGuy(120, 100,4));
			
			add(new Mesa(400, 300));
			add(new LineGuy(400, 300, 3));
			add(new LineGuy(470, 300,1));
			
			add(new Mesa(550, 400));
			add(new LineGuy(550, 400, 1));
			add(new LineGuy(620, 400,1));
			
			add(new Mesa(50, 500));
			add(new LineGuy(50, 500, 2));
			add(new LineGuy(120, 500,3));
			
			add(new Mesa(600, 500));
			add(new LineGuy(600, 500, 4));
			add(new LineGuy(720, 500,4));
			
						
			add(player);
			
			add(new Dialog("Por favor, dirijase a la mesa que preparamos exclusivamente para usted.", 20,260, 5, 200));
		}
		override public function end():void
		{
			this.clearRecycledAll();
			removeAll();
			
		}
		override public function update():void
		{
			
			if (mesa.collide("Couple", mesa.x, mesa.y))
			{
				FP.world = new IntermediaScene("Comiamos tranquilos cuando se desato la masacre",new CutScene());
				removeAll();
			}
			else if (player.collide("Mesa", player.x, player.y)   || player.x<0 || player.y<0)
			{
				FP.world = new FifthScene();
				
			}
			
			super.update()
		}
	}

}